import { createRouter, createWebHashHistory } from 'vue-router'
import layout from '@/views/Layout'
const routes = [
  {
    path: '/',
    component: layout,
    children: [
      {
        path: '/',
        component: () => import('@/views/Home')
      },
      {
        path: 'cart',
        component: () => import('@/views/Cart')
      },
      {
        path: 'category/:id',
        component: () => import('@/views/Category')
      },
      {
        path: '/category/sub/:id',
        component: () => import('@/views/Category/Sub')
      },
      {
        path: '/goods/:id',
        component: () => import('@/views/Goods')
      },
      {
        path: '/settlement',
        component: () => import('@/views/Settlement')
      },
      {
        path: '/pay',
        component: () => import('@/views/Pay')
      },
      {
        path: '/pay/callback',
        component: () => import('@/views/Pay/callback.vue')
      },
      {
        path: '/member',
        component: () => import('@/views/Member/Layout'),
        children: [
          {
            path: '',
            component: () => import('@/views/Member/Home')
          },
          {
            path: 'order',
            component: () => import('@/views/Member/Order')
          },
        ]
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/Login')
  },
  {
    path: '/playground',
    component: () => import('@/views/Playground')
  },
  {
    path: '/login/callback',
    component: () => import('@/views/Login/callback')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
